knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(sp)
library(raster)
library(rgdal)
library(leaflet)
library(dplyr)
library(magrittr)
library(wesanderson)
library(sf)
library(tigris)
library(ggspatial)
Background
In the United States especially, development of urban spaces and communities have been unequal and inextricably linked to power dynamics between different populations. For example, redlining in the 1930s has resulted in the continuing residential segregation of poorer people of color in areas that have had divestment in greenspace, walkability, and general development (Nardone et al., 2021). Many case studies have seen temperature differentials between the poorest and richest neighborhoods across the United States during the summer months, putting those who have lesser access to resources more at risk for heat-related health outcomes (Popovich et al., 2019).
Data sources:
Mapping Inequality: redlined neighborhoods in Oakland, CA
Office of Environmental Health Hazards Assessment (OEHHA): CalEnviroScreen 4.0
US Census Bureau: census tracts and county shapefiles (via Tigris library)
Example map:
#two shapefiles, plotted together with minimal visual customization
example <- ggplot() +
#basemap of cartolight
annotation_map_tile(zoomin = 0, type = "cartolight") +
#census tracts with ces4 data, with grey fill (50% alpha), and grey outline (size = 0.25)
geom_sf(data = eastbay_tracts_ces4,
fill = "grey99",
color = "grey35",
size = 0.25,
alpha = 0.5) +
#redlined neighborhoods with
geom_sf(data = redline_oak,
aes(color = holc_grade,
fill = holc_grade),
alpha = 0.75,
size = 0.5) +
theme_classic()
example
## Zoom: 12
Plot 1)
*for palettes, use scale_fill_manual and
scale_color_manual
oakland_redlined <- ggplot() +
annotation_map_tile(zoomin = 0, type = "cartolight") +
geom_sf(data = eastbay_tracts_ces4,
fill = "grey99",
color = "grey35",
size = 0.25,
alpha = 0.5) +
geom_sf(data = redline_oak,
aes(color = holc_grade,
fill = holc_grade),
alpha = 0.75,
size = 0.5) +
theme_classic() +
scale_color_manual(values = c("#77A865", "#7CB5BD", "#FFFF02", "#DA838D")) +
scale_fill_manual(values = c("#77A865", "#7CB5BD", "#FFFF02", "#DA838D"))
oakland_redlined
## Zoom: 12
Plot 2)
PM2_5 <- ggplot() +
annotation_map_tile(zoomin = 0, type = "cartolight") +
geom_sf(data = eastbay_tracts_ces4,
fill = "grey99",
color = "grey35",
size = 0.25,
alpha = 0.5) +
geom_sf(data = eastbay_tracts_ces4,
aes(fill = pm2.5_pctl),
alpha = 0.75,
size = 0.5) +
theme_classic() + scale_fill_stepsn(colors = c("white","#7DC8EF", "#112931", "black"),
space = "Lab",
na.value = "grey80",
guide = "coloursteps",
aesthetics = "fill",
#manually indicate at which values where breaks should go
breaks = c(15, 20, 25, 30, 35, 40, 45, 50),
#manually indicate what values the scale should cover
limits = c(0, 100))
PM2_5
## Zoom: 12
#PART 2: GIS LEAFLET MAP
Glucose-6-phosphate-dehydrogenase deficiency (G6PDd) is a genetic disorder that causes red blood cells to break down prematurely in response to certain medications, infections, or other stressors [5]. G6PDd is more common among males, especially in parts of Africa, Asia, and the Mediterranean. [6]
-Use G6PDd survey data in India using a dataset accessed through The Malaria Atlas Project.
G6PD_Data <- read.csv("/Users/annikaramona/Desktop/Working Directory for R/G6PD_Data_INDIA.csv")
head(G6PD_Data)
## FID id country latitude longitude area_type sexes
## 1 G6PD_Data.279 279 India 30.7390 76.7830 Small polygon Both
## 2 G6PD_Data.263 263 India 21.3000 72.8490 Point Both
## 3 G6PD_Data.264 264 India 21.2187 72.8284 Point Both
## 4 G6PD_Data.265 265 India 21.1960 72.8190 Point Both
## 5 G6PD_Data.266 266 India 25.2800 91.7240 Point Both
## 6 G6PD_Data.267 267 India 24.7358 92.7802 Admin2 centroid Both
## number_males number_males_deficient number_females number_females_deficient
## 1 1650 118 350 20
## 2 77 20 45 6
## 3 61 13 70 8
## 4 35 5 22 3
## 5 111 5 71 0
## 6 131 1 107 0
## citation
## 1 Jolly, J. G., B. M. Sarup, et al. (1972). "Glucose-6-phosphate dehydrogenase deficiency in India." J Indian Med Assoc 58(6): 196-200.
## 2 Gupte, S. C., A. N. Shaw, et al. (2005). "Hematological findings and severity of G6PD deficiency in Vataliya Prajapati subjects." J Assoc Physicians India 53: 1027-1030.
## 3 Gupte, S. C., A. N. Shaw, et al. (2005). "Hematological findings and severity of G6PD deficiency in Vataliya Prajapati subjects." J Assoc Physicians India 53: 1027-1030.
## 4 Gupte, S. C., A. N. Shaw, et al. (2005). "Hematological findings and severity of G6PD deficiency in Vataliya Prajapati subjects." J Assoc Physicians India 53: 1027-1030.
## 5 Saha, N., S. H. Hong, et al. (1990). "Red cell glucose-6-phosphate dehydrogenase phenotypes in several Mongoloid populations of eastern India: existence of a non-deficient fast variant in two Australasian tribes." Ann Hum Biol 17(6): 529-532.
## 6 Saha, N., S. H. Hong, et al. (1990). "Red cell glucose-6-phosphate dehydrogenase phenotypes in several Mongoloid populations of eastern India: existence of a non-deficient fast variant in two Australasian tribes." Ann Hum Biol 17(6): 529-532.
## area_size country_id malaria_metrics_available
## 1 35 IND TRUE
## 2 10 IND TRUE
## 3 10 IND TRUE
## 4 10 IND TRUE
## 5 10 IND TRUE
## 6 3391 IND TRUE
#data cleaning
G6PD_Data <- G6PD_Data %>% dplyr::select(latitude, longitude, number_males, number_males_deficient)
Plotting the prevalence of G6PDd among men will be more meaningful than plotting counts.
\[ Prevalence = \frac{G6PDd\;males}{total\;number\;of\;males} \] Create a new column called G6PDd_pr. Round the prevalences to 2 decimal points using the round() function.
G6PD_Data <- G6PD_Data %>% mutate(G6PDd_pr = number_males_deficient/number_males)
G6PD_Data$G6PDd_pr <- round(G6PD_Data$G6PDd_pr,2)
create a dataframe, include all 5 columns.
dataframe <- SpatialPointsDataFrame(
coords = G6PD_Data[,c("longitude", "latitude")],
data = G6PD_Data[,c("longitude", "latitude","number_males", "number_males_deficient", "G6PDd_pr")],
proj4string = CRS("+init=epsg:4326"))
dataframe
## class : SpatialPointsDataFrame
## features : 45
## extent : 72.819, 94.115, 8.6654, 32.5396 (xmin, xmax, ymin, ymax)
## crs : +proj=longlat +datum=WGS84 +no_defs
## variables : 5
## names : longitude, latitude, number_males, number_males_deficient, G6PDd_pr
## min values : 72.819, 8.6654, 13, 0, 0
## max values : 94.115, 32.5396, 1650, 118, 0.3
-load in Admin 1 boundaries for India.
adminboundaries <- raster::getData("GADM", country="IND", level=1)
## Warning in raster::getData("GADM", country = "IND", level = 1): getData will be removed in a future version of raster
## . Please use the geodata package instead
colorpalette <- colorNumeric(wesanderson::wes_palette("Zissou1")[1:5], dataframe$G6PDd_pr, n = 5)
map3 <- leaflet() %>%
addProviderTiles("CartoDB.Positron") %>%
setView(lat = 20, lng = 83.000, zoom = 3.5) %>%
addPolygons(data = adminboundaries,
popup = adminboundaries$NAME_1,
color = "gray") %>%
addCircleMarkers(data= dataframe,
color=colorpalette(dataframe$G6PDd_pr),
radius = 8,
popup = paste("G6PD Prevalence",
dataframe$G6PDd_pr)) %>%
addLegend(pal = colorpalette,
title = "G6PD Prevalence",
values = dataframe$G6PDd_pr)
map3